# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.shortcuts import render

# Create your views here.
from django.http import HttpResponse
from .models import Categroy
import json


# def test(request):
#     res = Categroy.objects.all()
#     content = ''
#     content = content +'<html>'
#     for item in res:
#         content = content + '<li>'+str(item) + '</li>'
#     content = content + '</html>'


def test(request):
    res = Categroy.objects.all()
    print res
    content = []
    for item in res:
        content.append(item.getattrs(args=['name', 'create_time', 'update_time']))
        print content
        print type(content)
    # return HttpResponse('DFHFSGH')
    return HttpResponse(json.dumps(content))
